Program Index
Victor Help Contents

Menu Command Descriptions

Program Overview

Glossary

Victor Image Processing Library Information

Tips and Techniques

Victor Image Processing Help, version 4.10

(c) Copyright 1993-1996, Catenary Systems Inc


Command Descriptions

File Menu

Edit Menu

Window Menu

Bright Menu

Special FX Menu

Paste Special Menu

Convert Menu

Digitizer Menu


Program Features
Program Overview

This demonstration program is a full-featured image processing program for enhancing grayscale and RGB color images.

It demonstrates many of the capabilities of the Victor Image Processing Library for Windows. All of the features can be incorporated into your Windows application using Victor.

This program manipulates a single image at a time. Any rectangular area of this image can be saved as a file, copied to the clipboard, printed, image processed to enhance brightness and contrast, or altered to change its size or orientation. The rectangular area is set with the mouse: press the left mouse button, move the mouse to resize the rectangle and enclose the area, then release the mouse button.

This demo accepts an image file name at the command line and therefore can also be used as an image  file viewer. Just associate the file extensions BIF, BMP, GIF, JPEG, PCX, TGA, and TIFF with this executable. Then whenever you double click on an image file name the image will immediately be displayed.

Program capabilities:

File handling	Load and save BIF, BMP, GIF, JPEG, PCX, TGA, and TIFF file formats

Printing	Print bilevel,grayscale, or color images

Scanning	Control HP ScanJet scanners for scanning bilevel, grayscale, and color images

Image Processing	Adjust image brightness and contrast. Create special effects and change the image's size and orientation.

Image Conversion	Images can be converted between several formats: color to grayscale,  convert color images between 8- and 24-bit formats, or convert grayscale and black/white images between 1- and 8-bit formats..

Display Techniques	24- and 8-bit color images are converted to color dithered images for display in display modes with limited color capabilities. The color conversion can be selected for use of a unique optimized palette or a standard rainbow palette.

For information about the menu commands see Menu Command Descriptions.

For more information about using this program see Tips and Techniques.


Glossary

BIF	Binary Information File format, contains only brightness data stored as 1 byte per pixel. Values range from 0 to 255. The image data is stored in rows where the first row corresponds to the top of the image. There is no palette data.

bilevel image	1-bit image, contains only 2 colors, usually black and white. Each pixel is represented by 1 bit and each byte represents 8 pixels.

BMP	Bitmap file format for1-, 4-, 8-, and 24-bit images.

clipboard	Windows buffer for copying and pasting data.

color reduction	Reducing the number of colors in an image, for example, converting a 24-bit RGB image to an 8-bit image with 256 or fewer colors.

DIB	Device Independent Bitmap, Windows-defined format for describing images.

EPS	Encapsulated PostScript file format.

GIF	Graphics Interchange Format file developed by CompuServe.

grayscale image	Image data with pixel values representing shades of gray, where 0 represents black and 255 represents white.

Group 3	File compression scheme for 1-bit, optional for TIFF files.

Group 4	File compression scheme for 1-bit, optional for TIFF files.

histogram	Graph showing the relative number of pixels at each brightness level, used as an analytical tool.

more . . .


Glossary contd
Glossary continued

image area	Rectangular area within the image where operations take place, set with the mouse.

image buffer	Global memory where image data resides.

image processing	Manipulation of pixel brightness levels. Only grayscale or RGB color images should be processed.

JPEG	File format for 8- and 24-bit images. This is a "lossy" technique capable of very high compression ratios.

LZW	File compression scheme always used by GIF files, optional for TIFF files.

PackBits	File compression scheme for 1- and 8-bit images, optional for TIFF files.

palette color image	Image data with pixel values representing indexes into a 256-color lookup table known as the palette.

PCX	File format developed by Zsoft for use with PC PaintBrush.

RGB	Red, green, blue image data.

TGA	Targa file format for RGB and 8-bit images developed by Truevision.

TIFF	Tag Image File Format for bilevel, grayscale, and color images developed by Aldus, HP, and Microsoft.


Victor Library Overview
Victor Image Processing Library

Description	Victor Library is a DLL for creating powerful image-based Windows applications

Sample code	Writing an application is straightforward

Functions	Over 100 functions for working with images

Price	Victor Library for Windows $299, with complete source $699

Victor Library for 32-bit Windows $499, with complete source $899

Victor Library for DOS $199, with complete source $499

License	Royalty-free distribution of the DLL with your executable application

To Order	Call 	(314) 962-7833

fax	(314) 962-8037 (visa/mc/cod)

email	74176.225@compuserve.com

Be sure to visit the Catenary Systems web site for additional product information, demos, pictures, and what's new at  http://www.catenary.com/victor/

Victor Image Processing Library is a product of Catenary Systems, 470 Belleview, St Louis MO 63119.


Tips and Techniques

These are little nuggets of information that may help you in your use of this program and the Victor Library for Windows. For each item select "topic" to view the discussion.

How to adjust brightness . . . topic

Improving contrast . . . topic

Setting an image area . . . topic

Combining images . . . topic

What print mode to use . . . topic

Preparing an image for printing . . . topic

About Image File Formats . . . topic


Setting the Image Area
Setting an Image Area

An image area is a rectangular section within the image that is selected for manipulation.

When an image is loaded from a file, or captured by a scanner or framegrabber, the image area is set to the entire image. You can verify this by selecting Display Imgdes from the Window menu. A dialog box displays the properties of the image. The image area is defined by the start X, start Y, end X, and end Y values. The upper left corner of the image is the origin (0,0).

To set a smaller area, press the mouse left button and move the mouse to resize the rectangle until the section of interest is outlined. When the mouse button is released, the area is set and all subsequent image processing will operate only on the image area.

To reset the image area to the entire image select Reset image area from the Window menu.


How to Adjust Brightness

The brightness of grayscale and RGB color images may be adjusted.

Image brightness is altered by changing the pixel values. Increasing a pixel value increases its brightness. The following commands in the Bright menu allow you to adjust brightness in the image area.

Change brightness	Increase or decrease brightness by adding a value to every pixel.

Multiply	Increase brightness by multiplying every pixel by a factor.

Divide	Decrease brightness by dividing every pixel by a factor.

Exchange levels	Replace every pixel in a specified range with a single new value.

Raise for print	Brighten an image for printing. This corrects for the difference in the way images are displayed on the screen and how they appear when printed on a laser printer.

Gamma brighten	Brighten using a gamma function. This brightens just the intermediate pixels without affecting black or white pixels.


Improving Contrast

The contrast of grayscale and RGB color images may be adjusted.

To adjust the contrast of a palette color image, first convert it into an RGB image, use one of the commands listed below, then convert the image back into a palette color image.

Image contrast is altered by changing the pixel values throughout an image area to change the difference between the darkest and the lightest values. To increase the contrast in an image, make the dark pixels darker and the light pixels lighter.

The following commands in the Bright menu allow you to adjust contrast.

Equalize	Redistributes the pixel values so there appears to be an equal number of pixels at each intensity level. This creates a balanced image with equal areas of light and dark..

Expand contrast	Expand the contrast between two levels. The value entered for the minimum is changed to black (0) and the maximum is changed to white (255). All intermediate pixel values are spread out over the new range.

Kodalith	Create a high contrast image consisting only of black and white pixels.


Combining Images

There are several functions for combining images. They are invoked from the Paste Special menu. After an image area has been copied to the clipboard, it can be combined with the current image. Select the Paste Special menu and choose one of the methods. The clipboard object appears at the upper left corner of the screen and can be moved into position with the mouse. The clipboard image is cropped to fit within the dimensions of the current image. Double click or press the CTRL-V or INS key to combine the images, press ESC or DEL to cancel the operation.

Some of the combining techniques and their applications are:

Add	This method computes the sum of each pixel in the current image with the corresponding pixel in the clipboard image. Add can be used when scanning to increase the intensity and color saturation of the scanned image. Scan one image, copy it to the clipboard, scan again, and add the clipboard image to the current image.

Xor	This method is used for spotting differences between images. The resultant image is black where the pixels are identical.

Weighted Average	This method is useful for blending images. It also can be used when scanning as a means of reducing noise in the final image. Scan one image, copy it to the clipboard, scan again, and combine the two with a 50% weighted average.

Of course, all the methods can be used to create special effects.


What Print Mode to Use

There are three print modes:

Default	This mode is usable with all images. Use this method to print color pictures on color printers, and to print bilevel images on any printer. Do not use this method for grayscale images unless your printer driver directly supports grayscale printing (for example a PostScript printer).

B/W Halftone	Use this mode to print grayscale images. A halftone image that simulates 64 shades of gray is constructed for printing on any printer. The resulting halftone can be reproduced by photocopy or other means without picture degradation.

B/W Scatter	Use this mode to print grayscale images. A diffusion scatter image that simulates 256 shades of gray is constructed for printing on any printer. When sent to a printer operating at 300 dpi (or greater), this method produces a very high quality original print. However, this print may not reproduce well. The small, closely spaced dots sometimes become "muddy" when reproduced.


Preparing an Image for Printing

Color Images

Use the default print mode to print a color image to a color printer.

Before printing a color image on a black and white printer, convert it to grayscale by selecting Color to Gray from the Bright menu. Adjust the brightness and contrast as necessary for the grayscale image. Then follow the advice for grayscale images below.

Grayscale Images

Grayscale images are often disappointing when printed. An image that looks good on the computer screen can end up a dark gray mess when printed on a laser printer. The solution to this problem is to use image processing functions to enhance the image before printing.

Optimizing Brightness

When printed on a laser printer, an image appears darker than the corresponding screen image. Printer dots tend to spread and crowd out the white space while on the screen the white pixels glow and overpower the darker pixels. The result is a big difference between screen and printed image brightness. The solution is to work with the image until it looks good on the screen, then use the Raise for Print command in the Bright menu. This command uses the brightenmidrange function in the Victor Library which applies brightness correction to the middle brightness levels to reduce the difference between screen and laser printer appearance.

Creating a Sharper Image

Most grayscale images benefit from application of the Gently Sharpen command in the Special FX menu. Gentle sharpening is especially beneficial if you are using the halftone printing mode. Details tend to be lost in this printing mode and sharpening makes them stand out more.


Image File Formats

This program supports all the popular formats for raster images: BMP, GIF, JPEG, PCX, TGA, and TIFF. In this application files in these formats must have the corresponding extension.

This program can load the following file formats:

BIF	8-bit grayscale. This program assumes a BIF file is the same width as the last image displayed.

BMP	1-bit

4-bit (uncompressed or RLE4)

8-bit (uncompressed or RLE8)

24-bit

GIF	1- through 8-bit

JPEG	JPEG JFIF grayscale and color files, baseline and extended DCT, types SOF0 and SOF1

PCX 	bilevel, bitmapped, 8-bit grayscale or palette color, and 24-bit RGB color

TGA	8-, 16-, 24-, or 32-bit RGB color (uncompressed or compressed)

TIFF	1-bit (uncompressed, PackBits compressed, Group 3 or Group 4 compressed)

4- through 8-bit (uncompressed or PackBits)

8-bit (LZW compressed)

24-bit RGB color (uncompressed or LZW compressed)

If a file cannot be loaded, select the Info On command in the File Open dialog box to display information about the file. Contact Catenary Systems and we will determine why the file gives you trouble and how to remedy it.


Victor Description
Victor Library Description

Victor Library  is a powerful grayscale and color image processing library for working with BMP, GIF, JPEG, PCX, TGA, and TIFF images. With Victor you can create powerful image-based applications for Windows.

Victor is available in versions for DOS, Windows 3.1, or 32-bit Windows

Image processing functions include functions to adjust brightness, contrast, sharpen, outline, resize, rotate, overlay, matrix convolution, and more. Multiple, single, or partial images may be processed.

Color reduction functions convert 24-bit RGB images to 8-bit color images for fast and accurate image display, and for saving in 8-bit file formats.

Load and save images in BIF, BMP, GIF, JPEG, PCX, TGA,and TIFF file formats.

Print bilevel, grayscale, and color images at any size and position.

Scan bilevel, grayscale, and RGB color images with HP ScanJet scanners.

Digitizer support is available for several video framegrabbers.

Documentation includes a comprehensive User's Guide and Reference Manual and extensive example code written in C.

Victor comes with this demonstration program, which is a complete grayscale and RGB color image processing application, and the C source code to recreate it..

Victor is completely compatible with Visual Basic and includes a VB sample application to load and display an image..

The Victor Image Processing Library for Windows is in dll form. The 16-bit version supports Windows 3.1 or higher, the 32-bit version supports Windows 95, Windows NT, and Win32s. Victor can be used to create applications in any language that supports DLLs. Victor for Dos is a linkable library for Borland or Microsoft C/C++ compilers. No royalties. Full 30-day money back guarantee.

Prices:

Victor Library for Windows $299, with source $699

Victor Library for 32-bit Windows $499, with source $899

Victor Library for Dos $199, with source $499

To order contact  Catenary Systems:

voice	(314) 962-7833

fax	(314) 962-8037

email	74176.225@compuserve.com

url	http://www.catenary.com/victor/

We accept VISA, Mastercard, and COD orders.

Source code for the libraries supports Borland and Microsoft C/C++ compilers.


Sample code
Victor Sample Code

Programming with Victor is straightforward. Here is some sample code to load, sharpen, and display a 640 x 480 8-bit TIFF image.

Allocate image buffer and load image

imgdes image;

int width=640, length=480;

int bitsperpixel=8;

allocimage(&image, width, length, bitsperpixel);

loadtif("SPIDER.TIF", &image);

To gently sharpen and balance image contrast:

sharpengentle(&image, &image);

histoequalize(&image, &image);

To display the image the following code can be used:

HDC hDC;

PAINTSTRUCT ps;

HPALETTE hpal;

.

.

.

case WM_PAINT:

hDC = BeginPaint(hWnd,&ps);

viewimage(hWnd,hDC,&hpal,0,0,&image);

EndPaint(hWnd,&ps);

To free the image buffer before exiting the program:

freeimage(&image);


Function Summary
Victor Library Function Summary

Image Processing

Color Reduction and Image Conversion

File Handling

Color Palette Operations

Memory Management

Image Display and Analysis

Printer, Scanner, and Framegrabber Support


Image Processing Functions

Victor Library image processing functions alter the brightness values of an image. These functions can operate on multiple images, a single image, or any rectangular area within an image. Image processing can be applied to 8- and 24-bit images.

blur	smoothing filter

blurthresh	smoothing filter with threshold

brightenmidrange	raise brightness of middle levels

changebright	increase or decrease brightness

divide	divide by factor

exchangelevel	change range to new value

expandcontrast	increase contrast

gammabrighten	adjust brightness using a gamma factor

histobrighten	histogram brightening

histoequalize	histogram equalization

kodalith	create high contrast image

limitlevel	set maximum brightness level

matrixconv	matrix convolution

multiply	multiply by factor

negative	negative image (also for 1-bit)

outline	edge detection filter

pixellize	pixellation, mosaic effect

removenoise	median filter

sharpen	sharpening filter

sharpengentle	gentle sharpening filter

more . . .


Image Processing cont'd
Image Processing Functions continued

threshold	set minimum brightness level

usetable	assign brightness based on table

addimage	add two images

andimage	AND two images (also for 1-bit)

cover	overlay two images

orimage	OR two images (also for 1-bit)

subimage	subtract two images

wtaverage	weighted average of two images

xorimage	XOR two images (also for 1-bit)

zeroimage	set all pixel values to a value (also for 1-bit)

Image Manipulation

These functions alter an image area's shape, dimensions, position, or orientation. They can be applied to 1-, 8-, or 24-bit  images.

copyimage	copy image and palette

copyimagebits	copy image data

flipimage	flip image top to bottom

mirrorimage	reverse image left to right

resize	resize image

rotate	rotate image any angle (not for 1-bit image)

rotate90	rotate image 90 degrees (not for 1-bit image)


Color Reduction Functions
Color Reduction and Image Conversion

These Victor Library functions operate on images and color palettes and convert between image formats.

colordither	8- or 24-bit image to color dither image

colorscatter	8- or 24-bit image to color scatter image

colortogray	8- or 24-bit color image to grayscale

convert1to8bit	bilevel image to 8-bit image

convert8to1bit	8-bit image to bilevel image using kodalith, dither, or scatter technique

convertrgbtopal	RGB image to 8-bit with 2 to 256 colors

convertrgbtopalex	RGB image to 8-bit with 2 to 256 colors with color matching and diffusion scatter options

convertpaltorgb	8-bit image to RGB

dibtobitmap	DIB to a device specific bitmap

imagetodib	image area to a DIB

matchcolorimage 	match 8- or 24-bit image to a new palette

matchcolorimageex 	match 8- or 24-bit image to a new palette with color matching and diffusion scatter options

reduceimagecolors	reduce colors used in an 8-bit image


File Handling Functions

Victor Library loads and saves images in BMP, GIF, EPS (save only), JPEG, PCX, TGA, TIFF, and BIF (raw data) file formats

Victor Library for 32-bit Windows can handle images up to 32768 x 32768 pixels.

Victor Library for Windows can handle black and white images (1-bit) up to 32384 x 32768, grayscale or color images (4-, 8-, or 24-bit) up to 4048 x 32768.

bmpinfo	obtain information from BMP file

gifinfo	obtain information from GIF file

jpeginfo	obtain information from JPEG file

pcxinfo	obtain information from PCX file

tgainfo	obtain information from TGA file

tiffinfo	obtain information from TIFF file

loadbif	load 8-bit binary image data file

loadbmp	load 1-, 4-, 8-, or 24-bit BMP file (uncompressed or RLE)

loadgif	load 1- through 8-bit GIF file

loadgifpalette	load GIF palette

loadjpg	load JPEG grayscale or color compressed file

loadpcx	load 1-, 4-, 8-, or 24bit PCX file

loadpcxpalette	load PCX color palette

loadtga	load Targa 8-,16-, 24-, or 32-bit RGB file (uncompressed or compressed)

loadtgapalette	load Targa color palette

loadtif	load 1-, 4-, 8-, or 24-bit TIFF (uncompressed, G3, G4, PackBits, or LZW)

loadtifpage	load image from a multipage TIFF file

loadtifpalette	load TIFF color palette

loadtifpalettepage	load color palette from a multipage TIFF file

more . . .


File handling page 2
File Handling Functions continued

savebif	save image as 8-bit binary data

saveeps	save image as EPS file (grayscale or color)

savegif	save image as 1- or 8-bit GIF file

savegifex	save image as 1-, 4-, or 8-bit GIF transparent and/or interlaced file

savejpg	save image as a grayscale or color JPEG file (image quality, 1-100, determines amount of compression)

savepcx	save image as 1- or 8-bit PCX

savetga	save image as 24-bit RGB Targa (uncompressed or compressed)

savetif	save image as 1-, 8-, or 24-bit TIFF (uncompressed, G3, G4, PackBits, or LZW)

getgifcomment	retrieve comment from GIF file

setgifcomment	sets comment to be saved in GIF file


Color Palette Functions

These Victor Library functions operate on color palettes and convert between palette formats.

copyimagepalette	copy an image's palette data

hsv2rgb 	convert hue, saturation, value table to red, green, blue palette

rgb2hsv 	convert red, green, blue palette to hue, saturation, value table

victowinpal	convert image palette to Windows logical palette

wintovicpal	convert Windows logical palette to image palette


Memory Management Functions
Memory Management

Victor functions operate on images stored as Device Independent Bitmaps (DIBs) in global memory. These functions allocate and free global memory for image storage.

allocimage	allocate space for an image in global memory

freeimage	free an allocated image


New

New creates a new image of specific size and bits per pixel. Enter the dimensions and bits per pixel of the image to create in the New dialog box.

Tip: To paste a palette color image into the new image and ensure that the new image has the correct colors:

First paste the palette, then paste the DIB.


Image Display Functions
Image Display and Analysis

Display Functions

Victor Library display functions allow the image area or the histogram data to be displayed on the computer screen.

drawhisto	display graph of the relative number of pixels at each brightness level on a device context

viewimage	display image on a device context

viewimageex	display image with automatic color reduction

Image Analysis

These functions allow you to examine individual or groups of pixel values.

calcavglevel	calculate average brightness

calchisto	calculate histogram

getpixelcolor	read a pixel value

pixelcount	count pixels in brightness range

setpixelcolor	set pixel value


Printer, Scanner, and Framegrabber Functions
Printer, Scanner, and Framegrabber Support

Printer Function

The Victor Library printer function prints an image area on a printer device context. Images can be printed in color or black and white to any Windows-supported printer. Print methods supported are halftone, diffusion scatter, and default. Use printimagenoeject to print multiple images and text on a single page.

printimage	print an image

printimageenddoc	ejects the printed page

printimagenoeject	print an image without ejecting the page

printimagestartdoc	initializes the printer before printing one or more images

Scanner Control

Victor Library ScanJet functions set scanner parameters, return parameter values, and capture bilevel, grayscale, and RGB color images from HP ScanJet scanners.

SJdetect	detect scanner driver and issue handle

SJdetectdriver	detect scanner driver

SJerrno	get last error code

SJgetcurrent	get current value of a parameter

SJgetdatawidth	get output data width in bits

SJgetdatatype	get output data type

SJgetmax	get maximum value of a parameter

SJgetmin	get minimum value of a parameter

SJgetscanbytes	get width of scan window in bytes

SJgetscanrows	get scanlines in scan window

SJmodel	identify scanner model

SJsetcontrast	set contrast of scanned image

SJsetintensity	set intensity of scanned image

SJsetdatatype 	set scanner data type

SJsetdatawidth	set data width in bytes

SJscanimage 	scan into an image buffer

SJwinsize 	set the scanner window

SJxyres	set scanner resolution

Video Digitizer Support

Optional support is available for Catenary, HRT, IDEC, Jovian Logic, and Quanta video frame grabbers.

Victor Library support for video framegrabbers includes functions to:

capture an image

frame average multiple images

view continuous video in a Window

adjust operating parameters


File Menu

The File menu includes commands to load and save image files, print images, control a ScanJet scanner, and exit the program.

New	Create a new image

Open	Load an image file

Save	Save the current image

Save As	Save the image as a new file

Save Area	Save only the image area as a new file

Print	Print the image

Scan Image	Scan an image with an HP ScanJet

Exit	Exit program


Edit Menu

The Edit menu includes commands to move an image area to and from the clipboard, to paste a palette from the clipboard, and to undo a previous image processing operation.

Undo	Cancel the previous operation

Copy	Copy the image area to the clipboard as a DIB

Paste Palette	Paste a palette from the clipboard into the current image

Paste DIB	Paste a DIB from the clipboard into the current image


Window Menu

The Window menu includes commands to display a histogram, display information about the current image, reset the image area, and set the type of display for 24-bit images.

Histogram	Display histogram of image area

Display Imgdes	Display image descriptor information

Reset Image Area	Set image area to the entire image

24-bit Display	Toggle display mode for 24-bit RGB image


Bright Menu

The Bright menu includes image processing commands to alter the brightness and contrast of a grayscale or color image area. The negative function is also available for bilevel images.

Equalize	Histogram equalization

Histobrighten	Histogram brightening

Expand contrast	Expand the contrast between two levels

Change brightness	Increase or decrease brightness

Multiply	Increase brightness by a multiplier

Divide	Decrease brightness by a divisor

Exchange levels	Set a range of pixel values to a new level

Negative	Create a photographic negative

Kodalith	Create a high contrast image

Raise for print	Brighten an image for printing

Gamma brighten	Brighten using a gamma function


Special FX Menu

The Special FX menu includes image processing commands to alter the appearance of a grayscale or color image area. The flip, mirror, and resize functions also operate on bilevel images.

Gently sharpen	Gentle sharpening filter

Sharpen	Sharpening filter

Outline	Outline filter

Trace	Create a white and black outline

Remove noise	Median filter to remove noise

Convolution	User-defined convolution filter

Blur	Smoothing filter

Pixellize	Create a mosaic effect

Posterize	Reduce the number of brightness levels

Flip	Flip the image area top to bottom

Mirror	Mirror the image area left to right

Rotate	Rotate 90 degrees

Resize	Enlarge or reduce an image area

Fountain	Create a grayscale fountain


Paste Special Menu

The Paste Special menu includes commands to combine an image on the clipboard with the current image. The clipboard and current image must both have the same bits per pixel. Palette color images should both have the same palette.

These commands are not available if the clipboard is empty. The Add, Cover, Subtract, and Weighted average commands are not available for bilevel images.

Add	Add the clipboard image to the current image

And	AND the clipboard image with the current image

Cover	Cover the current image with the clipboard image

Or	OR the clipboard image with the current image

Subtract	Subtract the clipboard from the current image

Weighted average	Compute a weighted average of the clipboard image with the current image

Xor	XOR the clipboard image with the current image


Convert Menu

The Convert menu contains functions to convert images between formats.

Color to gray	Convert a color image to grayscale

RGB image to palette	Convert a 24-bit RGB image to an 8-bit palette color image

Palette image to RGB	Convert an 8-bit palette color image to 24-bit RGB

Reduce palette colors	Reduces the number of colors used in an 8-bit image

Convert1to8	Convert a 1-bit black and white image to an 8-bit grayscale image

Convert8to1	Convert an 8-bit grayscale image to a dithered 1-bit black and white image


RGB image to palette

RGB image to palette uses color reduction to convert a 24-bit RGB image to an 8-bit palette color image.

There are two main reasons to employ color reduction:

To accurately display an RGB image on a display adapter limited to 256 or fewer colors.

To reduce the disk space needed to store the image

Unlike the image processing commands which operate on an image area, this command works on the entire image. After the conversion the image area is reset to the entire 8-bit image.

This command uses the Victor Library convertrgbtopalex function to create an image with 256 colors.

In the demonstration program the color reduction method uses the constant CR_TSDNODIFF to create the most accurate 256 color image possible without using diffusion.


Palette image to RGB

Palette Image to RGB converts an 8-bit palette color image to a 24-bit RGB image.

Unlike the image processing commands which operate on an image area, this command works on the entire image. After the conversion the image area is reset to the entire 24-bit image.


Convert1to8

Convert1to8 converts a 1-bit black and white image to an 8-bit grayscale image.

This command is used to enable the processing of 1-bit images. For example, to outline a 1-bit image, convert it to an 8-bit grayscale image, perform the outline, and convert back into a 1-bit image.

Unlike the image processing commands which operate on an image area, this command works on the entire image. After the conversion the image area is set to the entire 8-bit image.


Convert8to1

Convert8to1 converts an 8-bit grayscale image to a 1-bit black and white image.

The resulting 1-bit image simulates the grayscale image by using a scatter pattern of dots to represent gray levels. To avoid the dotted  appearance and obtain solid areas of black and white, first process the grayscale image with the kodalith command, then select convert8to1.

Unlike the image processing commands which operate on an image area, this command works on the entire image. After the conversion the image area is reset to the entire 1-bit image.

This command uses the Victor Library convert8bitto1bit function to create a 1-bit image using error diffusion. The convert8bitto1bit function allows a programmer to select the type of grayscale conversion: threshold, dither, or diffusion scatter.


Open

Open loads or provides information about an image file. When a file is loaded, it becomes the current image.

The BIF, BMP, GIF, JPEG, PCX, TGA, and TIFF file formats are supported.

See Open Dialog for more information.


Open Dialog

The Open Dialog allows you to load or obtain information about an image file.

File Name

Enter the file name to load or receive information about.

Directories

Lists the current directory and any subdirectories.

List Files of Type

Selects the type of files to be listed. The following file formats are supported: BIF, BMP, GIF, JPEG, PCX, TGA, and TIFF

Drives

Lists the available drives.

Info on

Info on displays information about the file selected. This information is read from the file header.


Save

Save stores the current image in a file with the same name. The entire current image is saved. If an image has not been saved before Save uses the default file type set in the Save As dialog.


Save As

Save As lets you name and save a new image file. The entire current image is saved. The available file formats depend upon the bits per pixel of the image.

The following file formats are supported:

1-bit	BMP, PCX, TIFF uncomp, TIFF Group 3, TIFF Group 4, TIFF PackBits

8-bit	BIF, BMP, BMP RLE8, EPS, GIF, JPEG, JPEG medium quality, PCX, TIFF uncomp, TIFF PackBits, TIFF LZW

24-bit	BMP, JPEG, JPEG medium quality, TGA, TGA compressed, TIFF uncomp, TIFF LZW

See Save Dialog for more information.


Save Area

Save Area saves an image area as a new image file.

The area saved is the last rectangle selected with the mouse, or the entire image if an area was not set.

See Save Dialog for more information.


Save Dialog

The Save dialog box saves an image or image area as a new image file.

File Name

Enter the filename to use to save the image.

Directories

Lists the current directory and any subdirectories.

Save File as Type

Select the file format to use for the image. The following file formats are supported:

1-bit	BMP, PCX, TIFF uncomp, TIFF Group 3, TIFF Group 4TIFF PackBits

8-bit	BIF, BMP, BMP RLE8, EPS, GIF, JPEG, JPEG medium quality, PCX, TIFF uncomp, TIFF PackBits, TIFF LZW

24-bit	BMP, JPEG, JPEG medium quality, TGA, TGA compressed, TIFF uncomp, TIFF LZW

Drives

Lists the available drives.


Print

Print sends the selected image area to the printer selected as the default printer.

Set the position and size of the printed image in mils (thousands of an inch, 1000 mils equals 1 inch.)

Set the thickness of the border surrounding the printed image in printer device pixels. If the entry is zero a border will not be printed.

Print mode

Available print modes are:

Default --usable for all images, calls the Windows StretchDIBits function which uses the printing capabilities of the printer driver. The quality of the printed image is dependent upon the capability of the printer driver.

B/W Halftone -- for grayscale images. Use this method to print images that will be reproduced by photocopy or offset printing.

B/W Scatter -- for grayscale images. This method is slower, but generates a very high quality original image on a 300 dpi printer. It may become "muddy" when reproduced.

Print length

If the Print length auto adjust option is checked, the print length is calculated so that the image aspect ratio will be maintained.

See Print Dialog for more information.


Print Dialog

The Print dialog box lets you set the position and size of the printed image, a frame width, and the print mode.

Print position and size should be entered in mils, where there are 1000 mils per inch.

Print position (in mils)

The X and Y coordinates of the upper left corner of the printable page are (0,0).

X	Enter the X coordinate of the upper left corner where the image is to be printed. The valid range is displayed to the left of the edit control and is based on the width of the page.

Y	Enter the Y coordinate of the upper left corner where the image is to be printed. The valid range is displayed to the left of the edit control and is based on the length of the page.

For example, to print an image beginning 1 inch in from the left and 3 inches from the top, specify 1000 for X and 3000 for Y.

Print size (in mils)

Width	Enter the width of the image to be printed. The valid range is displayed to the left of the edit control and is based on the width of the page and the X starting position.

Length	Enter the length of the image to be printed. The valid range is displayed to the left of the edit control and is based on the length of the page and the Y starting position. A value cannot be entered if the Length auto adjust box is checked.

For example, to print an image 5 inches wide and 7 inches long, enter 5000 for the width and 7000 for the length.

Length auto adjust

If the auto adjust box is checked the printed image length will be set automatically to maintain the aspect ratio of the image when printed.

Frame width

The frame width determines the width of the lines used to draw a border around the printed image. If set to zero, a border will not be printed. Units are in printer pixels.

Print mode

Three print modes are supported:

Default	prints the image using the currently selected printer driver, usable with all images.

B/W Halftone	prints the image as a halftone simulating 64 shades of gray, suitable only for grayscale images.

B/W Scatter	prints the image using a diffusion scatter technique simulating 256 shades of gray, suitable only for grayscale images.


Scan Image

Scan Image controls an HP ScanJet scanner for scanning a bilevel, grayscale, and color image.

Preview scans the entire scanbed. The preview scan allows you to select easily the scan area.

To set the scan area press the mouse left button and move the mouse to resize the rectangle until the section of interest is outlined. When the mouse button is released, the area is set. The position and size of the area of interest will appear in the Scan Image dialog box. The resolution will be set so that the scanned image will be approximately 640 pixels wide.

Scan Image scans a selected area

In the Scan Image dialog box, set the position and size of the scanned image in units of 300 dots per inch. If a preview scan was performed, the size and position values will reflect the area set in the preview scan discussed above.

Output data type

Supported scanner data types are black and white lineart, black and white dither, grayscale, and 24-bit color RGB.

See Scan Image Dialog for more information.


1,2,3,4 Commands

Refers to the files listed at the bottom of the File menu. The names on the list are the last four files used.

To open one of these files, select the filename from the list.


Scan Dialog
Scan Image Dialog

Scan Image allows you to scan a selected area

In the Scan Image dialog, set the position and size of the scanned image, scanner resolution, intensity, contrast, and output data type of the scanned image.

If a preview scan was performed, the size, position, and resolution values will reflect the area set in the preview scan.

Start Scan at Position (in units of 300 dpi)

The X and Y coordinates of the upper left corner of the scanbed are (0,0).

X	Enter the X coordinate of the upper left corner of the area to be scanned. The valid range is displayed to the left of the edit control and is based on the width of the scanbed.

Y	Enter the Y coordinate of the upper left corner of the area to be scanned. The valid range is displayed to the left of the edit control and is based on the length of the scanbed.

For example, to begin a scan at 1 inch in from the left and 3 inches down from the top specify 300 for X and 900 for Y.

ScanSize (in units of 300 dpi)

Width	Enter the width of the area to be scanned. The valid range is displayed to the left of the edit control and is based on the width of the scanbed and the X starting position.

Length	Enter the length of the area to be scanned. The valid range is displayed to the left of the edit control and is based on the length of the scanbed and the Y starting position.

For example, to scan an image area 5 inches wide and 7 inches long, enter 1500 for the width and 2100 for the length.

Scan Conditions

Resolution	The scan resolution is measured in dots per inch. The valid range for the scanner is displayed.

Intensity	To brighten an image when scanning enter a higher number or adjust the scrollbar to the right.

Contrast	To increase contrast when scanning enter a higher number or adjust the scrollbar to the right.

Output data type

The output data type determines the type of image that will be scanned into the image buffer.

Lineart	bilevel black & white image, suitable for documents

BW dither	bilevel black & white image, imitates a halftone, usable for photographs

Grayscale	8-bit grayscale image, suitable for photographs

Color 24-bit	24-bit RGB color image, suitable for photographs


Exit

Exit ends the program.


Paste DIB

The Paste DIB command pastes the contents of the clipboard into the current image. The object on the clipboard must be a Device Independent Bitmap (DIB).

See PasteOperation


Paste Palette

The Paste Palette command pastes a palette on the clipboard into the current image. No palette matching is performed.


Copy

Copy copies an image area and palette to the clipboard.

The image on the clipboard is a Device Independent Bitmap (DIB) and can be pasted into the current image using the Paste DIB command. It can also be combined with the current image by selecting one of the Paste Special commands.


Undo

Undo reverses the last image processing operation.

The undo operation is only one action deep. For example, if you use Sharpen three times, you can only undo the last Sharpen.

The undo operation will fail if the previous operation was performed on an image with a different bits per pixel than the current image. In this case the error message "Image bits per pixel not supported by function" is displayed.


Histogram

Histogram displays or hides the histogram of the image area.

The histogram is a graph of the relative number of pixels at each brightness level.

For a grayscale image, 0 represents black and 255 represents white.

For an 8-bit palette color or 24-bit RGB color image, three graphs are displayed, one each for red, green, and blue data.

The histogram can be used as an analytical tool in applying image processing.


Display Imgdes

Display Imgdes displays information about the current image. Items displayed are:

Buffer address	Location of image data

Buffer width	Width in bytes

Start X, start Y	Upper left corner of the image area in pixels

End X, end Y	Lower right corner of the image area in pixels

Image width	Width in pixels

Image length	Length in pixels

Palette address	Location of palette data

Palette colors	Number of colors in the palette

Bits per pixel	1, 8, and 24 are supported

Image type	1 represents grayscale

DIB address	Location of DIB header data

DIB handle	Handle to bitmap (32-bit only)


Reset Image Area

Sets the image area to the entire image from whatever area had been previously set with the mouse.


Reduce palette colors

Reduce palette colors is a color reduction method that operates on an 8-bit image to force it to use fewer palette colors. Enter the desired number of final colors.

This operation can be used to create artistic posterization effects by entering a small value (about 5 to 10)

This function uses the Victor Library function reduceimagecolors which selects the colors that are most representative of the image and uses error diffusion to create the best image display.

Unlike the image processing commands which operate on an image area, this command works on the entire image. After the color reduction the image area is reset to the entire 8-bit image.


24 bit display
24-bit Display

24-bit display lets you choose the way a 24-bit image is displayed on a 256-color display adapter.

Create optimized palette displays the image using the 256 colors that best represent the entire image. Each image is displayed with a unique palette.

Use dither with rainbow palette displays the image using a dither technique with 256 colors of a standard palette. All images are displayed with the same palette.

Use scatter with rainbow palette displays the image using a diffusion scatter technique with 256 colors of a standard palette. All images are displayed with the same palette.

The checkmark indicates the current method of displaying a 24-bit image in a 256-color display mode.


Equalize

Equalize evenly distributes pixel values throughout the image area using histogram equalization. This balances the overall contrast of the image.

Pixel values are reassigned so that the integral of the resulting histogram increases linearly with brightness level.


Histobrighten

Histobrighten redistributes pixel values to brighten the dark areas of the image.

Pixel values are reassigned so that the integral of the resulting histogram increases quadratically with brightness level.


Expand Contrast

Expand contrast increases contrast by expanding the brightness range between the values entered for minimum and maximum .


Changebright

Changebright increases or decreases the brightness by adding to each pixel the value entered for amount.


Multiply

Multiply increases brightness by multiplying each pixel value by the factor entered for multiplier.


Divide

Divide decreases brightness by dividing each pixel value by the factor entered for divisor.


Exchange Levels

Exchange levels replaces every pixel between the minimum and maximum with the value entered for new.


Negative

Negative creates the photographic negative of the image area.


Kodalith

Kodalith creates a high contrast image containing only two levels of brightness.

Every pixel above the value entered for threshold is set to 255 and every pixel below the threshold is set to zero.


Raise for Print

Raise for print increases the brightness levels of the intermediate pixels. It corrects for the difference in image appearance between screen display and laser printed image.

This command calls the brightenmidrange function in the Victor Library.


Gamma brighten

Gamma brighten applies a gamma correction factor to image brightness.

To brighten an image enter a value between 0.0 and 1.0. The lower the value, the brighter the resulting image

To darken an image enter a value above 1.0. The higher the value, the darker the resulting image.

To reverse a gamma operation, select Gamma brighten a second time and enter the inverse of the previous gamma correction factor. For example, brighten an image with a gamma of 0.5, and restore it to its original appearance with a gamma of 2.0.

This command calls the gammabrighten function in the Victor Library.


Color to Gray

Color to gray converts an 8- or 24-bit color image to 8-bit grayscale.

This conversion should be used before printing a color image on a black and white printer.

Unlike the image processing commands which operate on an image area, this command works on the entire image. After the conversion to grayscale, the image area is reset to the entire image.


Gently Sharpen

Gently sharpen increases the perceived sharpness through matrix convolution with a mild sharpening filter:

0	0	0

-1	3	-1

0	0	0


Sharpen

Sharpen increases the perceived sharpness through matrix convolution with a sharpening filter:

-1	-1	-1

-1	9	-1

-1	-1	-1


Outline

Outline creates an outline through matrix convolution with an edge detection filter :

-1	-1	-1

-1	8	-1

-1	-1	-1


Trace

Trace produces an outline of the image on a black background.

Trace calculates the average pixel value of the area, uses that value as the threshold for a kodalith, and creates the outline.

The trace of the image is produced by calling three Victor functions:

The average pixel value of the area is computed by calcavglevel.

A black and white image is created by kodalith using the average pixel value as the threshold.

An outline is created with outline.


Remove Noise

Remove noise removes random noise by applying a 3 x 3 median filter.


Convolution

Convolution allows you to apply a 3 x 3 filter matrix to an image area.

Enter the 9 matrix elements and the divisor (all must be in the range -127 to 127).

If the matrix elements are whole numbers, enter them directly in the 3 x 3 matrix box and enter 1 for the divisor.

If the matrix elements are fractions, enter the numerators in the 3 x 3 matrix box, and the denominator for the divisor.


Blur

Blur softens an image area by replacing each pixel value with the average of the 9-pixel local area.


Pixellize

Pixellize creates a mosaic effect by assigning all pixel values in a local square region to the average value of that local region. Enter the pixel width of the region as the pixellation factor.


Posterize

Posterize reduces the number of brightness levels in the image area. Enter the desired number of final levels.

This operation works best for 8-bit grayscale images. It uses the Victor Library functions divide and multiply to alter the pixel values to generate  the final number of levels. The resulting image will have brightness levels evenly spaced throughout the 0 to 255 intensity range.

Another approach to posterization is available by selecting Reduce palette colors.


Flip

Flip flips the image area top to bottom.

To rotate an image 180 degrees, apply the Flip and Mirror operations.


Mirror

Mirror reverses the image area left to right.


Rotate

Rotate rotates the image area by any angle.

Enter the angle to rotate in degrees.


Resize

Resize enlarges or reduces the image area to create a new current image. Enter the final size of the new image as a percent of the original image. For example, to double the image size enter 200.

To isolate an image area and convert it into the current image enter 100.

This program arbitrarily sets the resize limits at 1 and 1000 percent of the original image.

This command calls the resize function in the Victor Library.

Victor Library for 32-bit Windows can enlarge images up to a final size of 32768 x 32768 pixels.

Victor Library for Windows can enlarge black and white images (1-bit) up to 32384 x 32768, grayscale or color images (4-, 8-, or 24-bit) up to 4048 x 32768.

The resize function can also be used to create a zoom window in your application The horizontal and vertical dimensions can be resized independently.


Fountain

Fountain fills the area with a gradual progression of pixel values from 0 (at top) to 255 (at bottom).


Add

Add adds the pixel values of the clipboard image to the pixel values in the current image.

See Paste Operation


And

And performs a bitwise AND operation between the pixel values of the clipboard image and the pixel values in the current image.

See Paste Operation


Cover

Cover places a copy of the clipboard image over the current image and allows a portion of the current image to show through.

The threshold value entered determines how much of the current image shows. Any clipboard image pixel having a value greater than the threshold will be visible in the resulting image.

See Paste Operation


Or

Or performs a bitwise OR operation between the pixel values of the clipboard image and the pixel values in the current image.

See Paste Operation


Subtract

Subtract subtracts the clipboard image pixel values from the current image pixel values.

See Paste Operation


Weighted Average

Weighted average combines the pixel values of the clipboard image and the current image. Enter the amount of weight to apply to the clipboard image.

See Paste Operation


Xor

Xor performs a bitwise XOR operation between the pixel values of the clipboard image and the pixel values in the current image.

See Paste Operation


Paste Operation

The Paste commands are:

Paste DIB

Add

And

Cover

Or

Subtract

Weighted Average

Xor

When one of these commands is selected a moveable copy of the clipboard image appears in the upper left corner of the main window. To move the image, place the cursor over it and press the mouse left button to begin dragging. (The cursor appears as a 4-headed arrow whenever it is over the clipboard image.)

To paste the clipboard image:

Double click the mouse left button or press the CTRL-V or INS key. The clipboard image is cropped to fit within the current image. The clipboard image and the current image must have the same bits per pixel. Otherwise, the error message "Image bits per pixel not supported by function" is displayed.

Tip: To paste a palette color image into a newly created image and ensure that the new image has the correct colors, first paste the palette, then paste the DIB.

To remove the clipboard image from the screen without pasting:

Press the ESC or the DEL key. The image will remain on the clipboard.


Digitizer Menu

The Digitizer menu includes commands to capture images and control a WinVisionPro framegrabber. This menu is available only in digitizer-specific versions of this program.

Capture an image	Capture and display an image from a framegrabber

Frame Average	Capture multiple images and display an averaged image

Continuous Video	Display video in a window

Options	Set framegrabber operating parameters

If the framegrabber is not detected, the capture commands will be disabled and only the Options command will be available.

Troubleshooting

If the only item enabled is Options, check the following:

that the base address corresponds to the jumper set on the digitizer

that the digitizer board is installed properly

If the error message No incoming video signal detected appears, the video signal was lost, check that the video camera is turned on and connected to the digitizer.


Capture Image
Capture an image

Capture an image transfers an image from the digitizer to the image buffer and displays the image in the main window. The digitizer captures the image as an 8-bit palette color image or as a 24-bit RGB image depending upon the Capture mode set in the Digitizer Options dialog.

This menu item is disabled if the digitizer is not detected. See the Digitizer Menu command.


Frame Average

Frame Average captures a series of video frames from the digitizer, calculates an average image, stores it in the image buffer, and displays the resulting image in the main window. The digitizer captures the image as an 8-bit palette color image or as a 24-bit RGB image depending upon the Capture mode set in the Digitizer Options dialog.

Enter the number of frames to average, 1 to 255.

Frame averaging can be used to improve the quality of an image by decreasing the noise level. For best results while frame averaging, light levels should remain constant and the subject motionless.

This menu item is disabled if the digitizer is not detected. See the Digitizer Menu command.


Continuous Video

Continuous Video displays grayscale images in a child window as they are being digitized. Video images are continuously transferred from the digitizer to the child window until the window is closed.

Continuous Video Window

The following commands are available in the Continuous Video window.

Close Command

Close closes the child window.

Capture Command

Capture transfers an image from the digitizer to the main window.

The speed at which the Continuous Video window updates depends upon the speed of the computer and the display adapter.


Digitizer Options
Options

Options allows setting the operating parameters of the framegrabber.

Brightness, contrast, and saturation

Set the brightness, contrast, and saturation of the incoming video signal.

Base Address

Set the base address to correspond to that set by the jumper on the digitizer board.

Video Standard

Select NTSC or PAL video based on the type of video camera connected to the digitizer.

Capture mode

Select 8- or 24-bit based on the type of image to capture.

Digitizer Resolution

Select pixel resolution of image to be captured.

Options may be saved in a configuration file by pressing the Save button.

See Options Dialog for more information.


WVPR Options Dialog
Options Dialog

The digitizer Options dialog lets you set the operating parameters of the WinVisionPro framegrabber.

Brightness

Set the brightness by entering a value between 0 (no brightness) and 255 (maximum brightness) or adjust the scroll bar. Setting the brightness only affects the incoming video signal and not a captured image.

Contrast

Set the contrast by entering a value between 0 (no contrast) and 255 (maximum contrast) or adjust the scroll bar. Setting the contrast only affects the incoming video signal and not a captured image.

Saturation

Set the saturation by entering a value between 0 (image is black and white) and 255 (maximum color) or adjust the scroll bar. Setting the saturation only affects the incoming video signal and not a captured image.

Base Address

Set the base address to correspond to that set by jumper on the board. The allowable addresses for the WinVisionPro are 0x220, 0x230, 0x240, and 0x250.

Video Standard

Select NTSC or PAL video based on the type of video camera connected to the digitizer. NTSC is common in the US. PAL is common in Europe and Asia.

Digitizer Resolution

Select 640x480, 512x480, or 512x480Z. The 640x480 and 512x480Z modes have square pixels, that is, an image captured in one ot these modes is displayed correctly. An image captured in the 512x480 mode is elongated.The 512x480Z resolution is a zoom mode that captures the central 80% of an image discarding the left and right edges.

Capture

Select 8-bit to capture images as 8-bit palette color images and select 24-bit to capture images as 24-bit RGB color images. The capture mode applies to images captured using the Capture command or the Frame Average command.

Options may be saved in a configuration file by pressing the Save button.